package com.hsjk.szwj.module.official.controller.app.video;

import com.hsjk.szwj.framework.common.pojo.CommonResult;
import com.hsjk.szwj.module.official.controller.app.video.vo.AppOfficialWebsiteVideoListReqVO;
import com.hsjk.szwj.module.official.controller.app.video.vo.AppOfficialWebsiteVideoListRespVO;
import com.hsjk.szwj.module.official.conver.video.OfficialWebsiteVideoConvert;
import com.hsjk.szwj.module.official.dal.dataobject.video.OfficialWebsiteVideoDO;
import com.hsjk.szwj.module.official.service.video.IOfficialWebsiteVideoService;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import java.util.List;

import static com.hsjk.szwj.framework.common.pojo.CommonResult.success;

/**
 * @author chenjiawei
 * @desc
 * @Date 2023/07/31 22:29
 **/
@Tag(name = "官网应用端 - 视频相关接口")
@RestController
@RequestMapping("/official-website/video")
@Validated
public class AppOfficialWebsiteVideoController {

    @Resource
    private IOfficialWebsiteVideoService officialWebsiteVideoService;

    @PostMapping("/list")
    @Operation(summary = "获取视频列表")
    public CommonResult<List<AppOfficialWebsiteVideoListRespVO>> getOfficialWebsiteVideoList(@Validated @RequestBody AppOfficialWebsiteVideoListReqVO reqVO) {
        List<OfficialWebsiteVideoDO> list = officialWebsiteVideoService.getOfficialWebsiteVideoList(reqVO);
        return success(OfficialWebsiteVideoConvert.INSTANCE.convertAppOfficialWebsiteVideoListRespVO(list));
    }
}
